package com.csj.mvvmtest.ui.second

import android.content.Intent
import androidx.fragment.app.FragmentActivity
import com.csj.mvvm.ui.base.BaseAdapter
import com.csj.mvvm.widget.clicks
import com.csj.mvvmtest.bean.NaviBean
import com.csj.mvvmtest.databinding.ItemSecondRightBinding
import com.csj.mvvmtest.ui.WebViewActivity
import com.csj.mvvm.ui.base.StartAct.onStart


class SecondRightAdapter(context: FragmentActivity, listDatas: ArrayList<NaviBean.ArticlesBean>) :
    BaseAdapter<ItemSecondRightBinding, NaviBean.ArticlesBean>(context, listDatas) {

    override fun convert(v: ItemSecondRightBinding, t: NaviBean.ArticlesBean, position: Int) {
        v.tvRight.text = t.title
        v.tvRight.clicks {
            t.link?.let {
                mContext.onStart<WebViewActivity>(
                    mContext,
                    Intent().putExtra(
                        "title",
                        t.title
                    ).putExtra("url", t.link)
                )
            }
        }
    }

}
